package annotation.util;

import java.lang.reflect.Field;

import annotation.annotations.Column;
import annotation.annotations.NotNull;
import annotation.common.Student;

public class ExtendsAnnotationResolver {
	public static void resolve() throws IllegalArgumentException, IllegalAccessException {
		Student student = new Student();
		student.setName("zs");
		student.setStudentId("16273");
		Field[] fields = Student.class.getDeclaredFields();
		for (Field field : fields) {
			field.setAccessible(true);
			System.out.println(field.get(student));
			System.out.println(field.getName());
			System.out.println(null == field.getAnnotation(NotNull.class));
		}
		Class<?> class1 = Student.class.getSuperclass();
		Field[] superFields = class1.getDeclaredFields();
		for (Field field : superFields) {
			field.setAccessible(true);
			System.out.println(field.get(student));
			System.out.println(field.getName());
			System.out.println(null == field.getAnnotation(Column.class));
		}
	}

	public static void main(String[] args) {
		try {
			resolve();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
